#import <UIKit/UIKit.h>

/**
 * An SFUEventSearchEngineDelegate is a protocol for a delegate that 
 * handles events with an SFU event search engine.
 *
 * @author      James Lin
 * @version     0.6.4
 * @since       0.5.1
 */
@protocol SFUEventSearchEngineDelegate <NSObject>

/**
 * Handle a search failed event.
 *
 * MUST be implemented.
 *
 * @param theConnection  the connection of the search that just failed
 * @param message        the error message from the failed connection
 */
- (void)searchDidFail:(NSURLConnection*)theConnection 
			withError:(NSString*)message;

/**
 * Handle a search complete event.
 *
 * MUST be implemented.
 *
 * @param theConnection  the connection that just finished;
 *                       nil if offline cache was used instead.
 * @param eventResults   the array of matched events if found;
 *                       nil otherwise.
 */
- (void)searchDidFinish:(NSURLConnection*)theConnection 
				results:(NSArray*)eventResults;

@optional

/**
 * Handle an updated progress event.
 *
 * Implementation is optional.
 * 
 * @param currentSize   the current size of data processed
 * @param expectedSize  the estimated total size of data to be processed
 */
- (void)updateProgress:(CGFloat)currentSize ofTotal:(CGFloat)expectedSize;

@end
